package com.asset.dispoal.plaintiffConfiguration;

import com.asset.dispoal.plaintiffConfiguration.api.ISysPlaintiffConfigurationService;
import com.asset.dispoal.plaintiffConfiguration.dto.SysPlaintiffConfigurationRequest;
import com.asset.dispoal.plaintiffConfiguration.dto.SysPlaintiffConfigurationResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.mhuang.pacebox.springboot.core.controller.BaseController;
import tech.mhuang.pacebox.springboot.core.permission.annotation.Permission;
import tech.mhuang.pacebox.springboot.protocol.Result;
import tech.mhuang.pacebox.springboot.protocol.data.PageVO;

/**
 * 案件原告配置表控制层
 *
 * @author: mhuang
 * @date: 2022-03-21 16:37:47
 */
@RestController
@RequestMapping("sys/plaintiffConfiguration")
@Api(value = "原告配置管理", tags = "原告配置管理")
public class SysPlaintiffConfigurationController extends BaseController {

    @Autowired
    private ISysPlaintiffConfigurationService sysPlaintiffConfigurationService;

    @Permission(code = "systemPlaintiffConfiguration:query", param = "create_user")
    @GetMapping(value = "/page")
    @ApiOperation(value = "分页查询", notes = "分页查询")
    public Result<PageVO<SysPlaintiffConfigurationResponse>> page(SysPlaintiffConfigurationRequest sysPlaintiffConfigurationRequest) {
        final Result<PageVO<SysPlaintiffConfigurationResponse>> pageVOResult = sysPlaintiffConfigurationService.queryPage(sysPlaintiffConfigurationRequest);
        return pageVOResult;
    }

    @Permission(code = "systemPlaintiffConfiguration:add")
    @PostMapping(value = "/insert")
    @ApiOperation(value = "添加", notes = "添加")
    public Result insert(@RequestBody SysPlaintiffConfigurationRequest request) {
        return sysPlaintiffConfigurationService.insert(request);
    }

    @Permission(code = "systemPlaintiffConfiguration:update")
    @PostMapping(value = "/update")
    @ApiOperation(value = "修改", notes = "修改")
    public Result update(@RequestBody SysPlaintiffConfigurationRequest request) {
        return sysPlaintiffConfigurationService.update(request);

    }

    @Permission(code = "systemPlaintiffConfiguration:del")
    @PostMapping(value = "/delete")
    @ApiOperation(value = "删除", notes = "删除")
    public Result delete(@RequestBody String id) {
        return sysPlaintiffConfigurationService.delete(id);
    }

}